def solve(nums):
    min_left=nums[0]
    ans=0
    for i in range(1,len(nums)):
        ans=max(ans,nums[i]-min_left)
        min_left=min(nums[i],min_left)
    return ans 

print(solve([9,11,8,5,7,12,16,14]))